

/**
 * given the initial position, compute the dx/dy/dz/elevation/azimuth, etc.
 * 
 * shjzhang, wuhan
 */

#ifndef ComputeDerivative_HPP
#define ComputeDerivative_HPP


#include "ProcessingClass.hpp"
#include "XvtStore.hpp"
#include "Bancroft.hpp"
#include "Position.hpp"
#include "DataStructures.hpp"

using namespace gpstk;

namespace gnssbox
{

    class ComputeDerivative 
    {
    public:

        // given initial nominal position, compute the partial ComputeDerivatives for
        // observables, including dx/dy/dz/dcdt, and the elevation, azimuth,
        // etc.
        ComputeDerivative()
           : minElev(10.0)
        {
            nominalPos = Position(0.0,0.0,0.0,Position::Cartesian,NULL);
        };


         /** Explicit constructor taking as input reference
          *  station coordinates.
          *
          * Those coordinates may be Cartesian (X, Y, Z in meters) or Geodetic
          * (Latitude, Longitude, Altitude), but defaults to Cartesian.
          *
          * Also, a pointer to EllipsoidModel may be specified, but default is
          * NULL (in which case WGS84 values will be used).
          *
          * @param aRx   first coordinate [ X(m), or latitude (degrees N) ]
          * @param bRx   second coordinate [ Y(m), or longitude (degrees E) ]
          * @param cRx   third coordinate [ Z, height above ellipsoid or
          *              radius, in meters ]
          * @param s     coordinate system (default is Cartesian, may be set
          *              to Geodetic).
          * @param ell   pointer to EllipsoidModel.
          * @param frame Reference frame associated with this position.
          */
        ComputeDerivative( const double& aRx,
                           const double& bRx,
                           const double& cRx,
                           Position::CoordinateSystem s = Position::Cartesian,
                           EllipsoidModel *ell = NULL,
                           ReferenceFrame frame = ReferenceFrame::Unknown );


         /// Explicit constructor, taking as input a Position object
         /// containing reference station coordinates.
        ComputeDerivative(const Position& staCoordinates);


         /** Return a satTypeValueMap object, adding the new data generated
          *  when calling a modeling object.
          *
          * @param time      Epoch.
          * @param gData     Data object holding the data.
          */
        virtual satTypeValueMap& Process(const CommonTime& time,
                                         satTypeValueMap& gData)
            noexcept(false);


         /** Return a gnssRinex object, adding the new data generated when
          *  calling a modeling object.
          *
          * @param gData    Data object holding the data.
          */
        virtual void Process(gnssRinex& gData)
            noexcept(false);


         /// Method to set satellite elevation cut-off angle. By default, it
         /// is set to 10 degrees.
        virtual ComputeDerivative& setMinElev(double newElevation)
        { minElev = newElevation; return (*this); };


         /// Return a string identifying this object.
        virtual std::string getClassName(void) const;


         /// Destructor.
        virtual ~ComputeDerivative() {};


    protected:

         /// The elevation cut-off angle for accepted satellites.
         /// By default it is set to 10 degrees.
        double minElev;

         /// Station position
        Position nominalPos;

    }; // End of class 'ComputeDerivative'

      //@}

}  // End of namespace gnssbox

#endif   // ComputeDerivative_HPP
